<?
	$db = GetDefaultConnection();

	$where .= " and PRODUCT_TOTAL>PRODUCT_TRADE and PRODUCT_ITEM1=$oitem1 and PRODUCT_ITEM2=$oitem2 and JBNH_SEQ=$jbnh_seq and PRODUCT_WEIGHT1=$oweight1 and PRODUCT_WEIGHT2=$oweight2 and PRODUCT_GRADE1=$ograde1 and PRODUCT_GRADE2=$ograde2 and PRODUCT_STANDARD1=$ostandard1 and PRODUCT_STANDARD2=$ostandard2 ";
	$sql = sprintf("SELECT * "
					.", (PRODUCT_TOTAL-PRODUCT_TRADE) as PaNumber "
					.", (select JBNH_NAME FROM TB_JBNH WHERE JBNH_SEQ=a.JBNH_SEQ) as JBNH_NAME "
					.", (select CODE_NAME FROM TB_CODE WHERE CODE_TYPE='A' AND CODE_CODE1=a.PRODUCT_ITEM1 AND CODE_CODE2=0) as ITEM1_NAME "
					.", (select CODE_NAME FROM TB_CODE WHERE CODE_TYPE='A' AND CODE_CODE1=a.PRODUCT_ITEM1 AND CODE_CODE2=a.PRODUCT_ITEM2) as ITEM2_NAME "
					.", (select CODE_NAME FROM TB_CODE WHERE CODE_TYPE='B' AND CODE_CODE1=a.PRODUCT_GRADE1 AND CODE_CODE2=a.PRODUCT_GRADE2) as ORDER_GRADE2_NAME "
					.", (select CODE_NAME FROM TB_CODE WHERE CODE_TYPE='B' AND CODE_CODE1=a.PRODUCT_STANDARD1 AND CODE_CODE2=a.PRODUCT_STANDARD2) as ORDER_STANDARD2_NAME "
					." FROM TB_PRODUCT a where 1=1 %s order by PRODUCT_SEQ desc "
					, $where);
	$list = $db->queryList($sql)
?>
<?
	if ($list->getLength() == 0)
	{
?>
			<tr>
				<td colspan=9>등록된 목록이 없습니다.</td>
			</tr>
<?
	}
	else
	{
		while ($list->hasNext())
		{
			$row = & $list->next();
			$product_seq = $row->getNumber('PRODUCT_SEQ');
			$jbnh_name = $row->getString('JBNH_NAME');
			$item1_name = $row->getString('ITEM1_NAME');
			$item2_name = $row->getString('ITEM2_NAME');
			$grade2_name = $row->getString('ORDER_GRADE2_NAME');
			$standard2_name = $row->getString('ORDER_STANDARD2_NAME');
			$product_weight2 = $row->getNumber('PRODUCT_WEIGHT2');
			$PaNumber = $row->getNumber('PaNumber');
?>
			<tr>
				<td><input type="checkbox" id="tseq" name="tseq[]" value="<?=$product_seq?>" title="해당리스트 수정 및 삭제 시 클릭하세요" /></td>
				<td><?=$jbnh_name?></td>
				<td><?=$item1_name?></td>
				<td><?=$item2_name?></td>
				<td><?=$grade2_name?></td>
				<td><?=$standard2_name?></td>
				<td><?=$product_weight2?>kg</td>
				<td><?=$PaNumber?>kg</td>
				<td><input type="hidden" name="pnumber" id="pnumber" value="<?=$PaNumber?>" /><input type="text" id="tradenum" name="tradenum[]" title="수량" class="boxinput w30"/></td>
			</tr>
<?
		}
	}
?>
